package com.mzj.saas.mservice.property.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.property.service.CommunityHouseExceptionService;
import com.mzj.saas.mservice.property.vo.CommunityHouseExceptionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 房屋状态登记
 */
@RestController
@RequestMapping("/property/communityHouseException")
public class CommunityHouseExceptionController {
    @Autowired
    private CommunityHouseExceptionService exceptionService;

	/**
	 * 查看房屋状态记录
	 * @param accessToken
	 * @param communityHouseId
	 * @return
	 */
    @GetMapping
    public ResultBean<List<CommunityHouseExceptionVO>> list(@RequestHeader String accessToken,
                                                            @RequestParam String communityHouseId) {
        return exceptionService.list(accessToken, communityHouseId);
    }

	/**
	 * 房屋状态登记
	 * @param accessToken
	 * @param communityHouseExceptionVO
	 * @return
	 */
    @PostMapping
    public ResultBean<CommunityHouseExceptionVO> save(@RequestHeader String accessToken,
                                                      @Valid @RequestBody CommunityHouseExceptionVO communityHouseExceptionVO) {
        return exceptionService.save(accessToken, communityHouseExceptionVO);
    }


}
